#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

static char buf[8192]__attribute((aligned(4096)));

int main(int agrc, char **argv){
    int fd;
    int count = 10000;

    fd = open(argv[1], O_WRONLY|O_CREAT|O_TRUNC|O_DIRECT, 0664);
    if(-1 == fd){
        perror("open error");
        exit(-1);
    }

    while(count--){
        if(4096 != write(fd, buf, 4096)){
            perror("write error");
            exit(-1);
        }
    }

    close(fd);
    exit(0);
}